import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from 'vite-plugin-windicss'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue(), WindiCSS()],
  server: {
    port: 8091,
    open: true,
    proxy: {
      '/api': {
        // target: 'http://192.168.3.135:8899', //home
        target: 'http://127.0.0.1:8899', //home
        // target: 'http://192.168.1.63:8899',// com
        // target: 'http://39.104.21.39:8899',// prod_dev
        // target: 'http://ceshi13.dishait.cn',// prod_run
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    },
    hmr: {
      host: 'localhost'
    },
    cors: true,
    // strictPort: true,
    // force: true,
    preload: true,

  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  // 预加载项目必需的组件
  optimizeDeps: {
    // include:["element-plus/es/components/scrollbar/style/css"]
  },
  base: './',

})
